﻿using System.ComponentModel;
using System.Windows;

namespace QuickMediaPlayerDemo
{
    /// <summary>
    /// MainWindow.xaml 的交互逻辑
    /// </summary>
    public partial class MainWindow : Window
    {
        public MainWindow()
        {
            InitializeComponent();
        }

        protected override async void OnClosing(CancelEventArgs e)
        {
            //没有销毁则取消
            if (!quickPlayer.IsDisposed)
            {
                e.Cancel = true;
                await quickPlayer.Destory();
                try
                {
                    this.Close();
                }
                catch { }
            }
        }

        private void quickPlayer_MediaChanged(object sender, MediaChangedEventArgs e)
        {
            this.Title = "QuickMediaPlayer - " + e.Url;
        }
    }
}
